/**
 * 
 */
package com.hst.web.sys.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang3.StringUtils;

import com.hst.core.annotation.Comment;

/**
 * @author wangyh
 */
@Entity
@Table(name = "sys_user_session")
@Comment("用户登陆信息表")
public class TUserSession implements Serializable {
	public final static String STATUS_ON = "1";
	public final static String STATUS_OFF = "0";

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(length = 40)
	@Comment("用户session id")
	private String id;

	@Column(length = 10)
	@Comment("用户ID")
	private String userid;

	@Column(length = 1)
	@Comment("登陆状态:1-有效，其他：无效")
	private String status;

	@Column(name = "login_time")
	private Date loginTime;

	@Column(name = "last_time")
	private Date lastTime;

	@Column(length = 20)
	private String ip;
	@Column(length = 100)
	private String agent;
	@Column(name="clnt_user", length = 20)
	private String clntUser;
	
	@Column(name="companyCode", length = 20)
	private String companyCode;

	public String getCompanyCode() {
		return companyCode;
	}

	public void setCompanyCode(String companyCode) {
		this.companyCode = companyCode;
	}

	public TUserSession() {
		super();
	}

	public TUserSession(String id, String userid, String status, Timestamp loginTime) {
		super();
		this.id = id;
		this.userid = userid;
		this.status = status;
		this.loginTime = loginTime;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUserid() {
		return userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getLoginTime() {
		return loginTime;
	}

	public void setLoginTime(Date loginTime) {
		this.loginTime = loginTime;
	}

	public Date getLastTime() {
		return lastTime;
	}

	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = StringUtils.substring(ip, 0, 20);
	}

	public String getAgent() {
		return agent;
	}

	public void setAgent(String agent) {
		this.agent = StringUtils.substring(agent, 0, 100);
	}

	public String getClntUser() {
		return clntUser;
	}

	public void setClntUser(String clntUser) {
		this.clntUser = StringUtils.substring(clntUser, 0, 20);;
	}
}
